from sqlalchemy import func, Column, String, DateTime

from ..database import database as db


class User(db.Model):
    __table_name__ = 'user'
    id = Column(String(12), primary_key=True)
    screen_name = Column(String(40))
    head_image = Column(String(400))
    created_at = Column(DateTime, default=func.now)
    updated_at = Column(DateTime, default=func.now)
    type  = Column(String(20),default='member')
    first_name = Column(String(80))
    last_name = Column(String(80))
    grade = Column(String(2), default='male')
    phone = Column(String(20), nullable=True)
    email = Column(String(100), nullable=True)
    status = Column(String(20), default='normal')


    # credit_rating = IntegerField(db_column='credit_rating', default=0, help_text='信誉等级')
    # screen_name = CharField(db_column='screen_name', max_length=40, help_text='显示名称')
    # head_image = CharField(db_column='head_image', max_length=400, help_text='头像地址')
    # sales_rate = DecimalField(db_column='sale_rate', default=0.00, decimal_places=1, help_text='卖家好评率')
    # buyer_rate = DecimalField(db_column='buyer_rate', default=0, decimal_places=1, help_text='买家好评率')
    # deal_count = IntegerField(db_column='deal_count', default=0, help_text='已成交数')
    # created_at = DateTimeField(db_column='created_at', default=datetime.datetime.now, help_text='创建时间')
    # updated_at = DateTimeField(db_column='updated_at', help_text='最后更新时间')
    # country = ForeignKeyField(Country)
    # currency = ForeignKeyField(Currency)
    # account = ForeignKeyField(Account)
    # secret_key = CharField(db_column='secret_key', default=shortuuid.uuid, max_length=64, help_text='会员安全key')
    # first_name = CharField(db_column='first_name', help_text='姓', null=True)
    # last_name = CharField(db_column='last_name', help_text='名', null=True)
    # grade = CharField(db_column='grade', help_text='姓别', default='male')
    # phone = CharField(db_column='phone', help_text='手机号码', null=True)
    # email = CharField(db_column='email', help_text='邮箱地址', null=True)
    # status = CharField(db_column='status', help_text='状态', default='normal', max_length=20)
